Skip to content

Planned work left on a draft PR is finished by CoderHelm; incident regression suite in CI - #361

Merged
nambok merged 1 commit into
mainfrom
finish-planned-work-and-incidents
Oct 29, 2026
Merged

nambok merged 1 commit into
mainfrom
finish-planned-work-and-incidents

Conversation

@nambok

@nambok nambok commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two long-term fixes.

  1. Planned work left on a draft PR is finished by CoderHelm. Since Every file a generator changes is committed, generated tasks it settled are done, and a finished run always opens a PR #358, a run whose check still finds planned work not done opens the PR as a draft with a "Not finished" section, and then leaves it for a person. Now CoderHelm keeps working those tasks in rounds on the PR. A round that makes progress is followed by another, using the same rule Runs keep going while they make progress; a step's time never fails a run #357 uses for steps. When nothing is left, the PR is marked ready. Two rounds in a row without progress stop the work: the run names the tasks and why, its status becomes needs_input (never completed), and the PR stays a draft.
  2. An incident regression suite runs in CI on every PR. Each run failure from the last two days is a case. The case replays the failure on an invented monorepo, through the pipeline's own decision code, with fakes only at the edges. It checks the run's final status, the PR and notes the run leaves, and that the old failure message never appears. Writing the suite found one more bug, fixed here (case d below).

Changes

Planned-work rounds (passes/finish_planned.rs, resume.rs, mod.rs, round.rs, common/run_round.rs, the stuck-run sweep)

  • New round kind run_round::Kind::PlannedWork (planned_work). It has the same budget, parking, WIP branch and one-commit landing as the other rounds. Round gains stalled, the number of rounds in a row without progress. The Python sweep knows the kind, and a test checks that it lists every kind.
  • When the PR opens with "Not finished", run_passes parks the first round, which runs 5 seconds later. If a security round is parked, that round runs first, and the planned-work round starts after it (start_planned_work).
  • after_planned_round handles each round:
    • Reruns the proof judge on the branch, against the run's cached plan and the generator outputs already settled (recheck_planned_work).
    • Rewrites the "Not finished" section, or removes it.
    • Decides with finish_planned::next. A round that pushed changes or finished a task is progress. A judge that can't answer counts as nothing done. steps::MAX_RUN_STEPS stays as the runaway ceiling.
    • Sets the run's status from finish_planned::run_status.
  • The "Not finished" text says CoderHelm keeps working on it there.
  • A retry while a planned-work round is under way or parked stops before writing (pr_holder::busy, as for other rounds).

Incident suite (passes/incidents/, CI job Incident regressions: cargo test -p worker 'incidents::', docs/incidents.md)

  • The fixture is a generic monorepo:
    • apps/studio: a CMS schema and a typegen script that writes apps/studio/schema.json, plus ../web/src/lib/sanity/sanity.types.ts.
    • apps/web.
    • e2e/ with a test map.
  • The fakes: an in-memory GitHub (compare and PR shapes), recorded judge replies read by the real parser, a sandbox with a real tar.gz and a CodeBuild-shaped log, and DynamoDB run records.
  • Small seams make the real decision code callable:
    • sandbox::codegen_outcome behind a CodegenSource trait. The sandbox client is one implementation, the fake is another.
    • generators::read_outcome, taken out of run_in_sandbox.
    • resume::draft_hold, taken out of mark_ready.
    • mod.rs::stopped_keeping.
    • sandbox::read_archive.
Case Guarantee Bug found
a. Last step writes nothing at 5 of 7 Judged on the whole branch; goes on to the checks No
b. Retry on a ticket with an open PR Continues that PR; never writes while the earlier run works on it (running, awaiting CI, writer slot, round parked) No
c. Codegen refused by the network allowlist Generator hosts are allowed; a refused host is a tooling failure naming it No
d. Buildspec echo with upload markers Markers count only on their own line Yes. A failed generator's reason quoted the first 300 characters of the log, which is CodeBuild's echo of the buildspec, so the error never showed. Fixed: it now quotes the generator's own last lines (failure_excerpt).
e. Generated file over 5 MB via ../ Committed, path normalized, task done in the plan check and the proof check No
f. Out of time at a gate Continues at that gate as a new message; 20 progressing steps continue; two stalled steps stop No (single repository; see gaps)
g. 40-file plan No cap, no narrowing; every round is told every task No
h. Stale description, duplicate comment, repeated question, e2e skip on missing content, wrong "could not look up" note Each is caught by its check No
i. Finished work ends with a PR Draft with "Not finished", then finished by CoderHelm (part 1) The part 1 gap, fixed here

Verification

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace: 0 failed. That is common 1281, gateway 605 and worker 1039 (31 of them in the incident suite), plus 2.
  • cargo test -p worker 'incidents::': 31 passed.
  • python3 -m unittest discover -s lambda/tests: 168 passed.
  • check_workflows.py and actionlint on the new job: clean.

Gaps:

  • The suite drives the decision code with fakes at its edges, not orchestrate_ticket from start to finish. The GitHub client has a fixed API base, and the AWS clients are built in main. Making them injectable is a separate change.
  • A multi-repository run that runs out of time at its generator gate still stops with an honest message. It can't continue in a fresh step yet.
  • Planned-work rounds run on single-repository runs. Multi-repository drafts with "Not finished" are still left for a person, because their resume (resume_multi_repo) runs no rounds.

…gression suite in CI

When the check before the pull request still finds planned work not done,
the draft PR with "Not finished" is no longer left for a person. CoderHelm
works those tasks in planned-work rounds on the pull request, each in a fresh
invocation with its own budget. After each round it judges the branch again,
rewrites the section, and marks the PR ready when nothing is left. Two rounds
in a row with no progress stop the work: the run names the tasks and why, its
status is needs_input (never completed), and the PR stays a draft.

The incident suite (worker passes::incidents, CI job "Incident regressions")
replays each run failure of the last two days on one invented monorepo,
through the pipeline's decision code, with fakes only at the edges: GitHub,
recorded model replies, the sandbox's archive and log, and run records.
docs/incidents.md lists each case and the guarantee it protects.

The suite found one bug: a failed generator's reason quoted the first 300
characters of the build log, which is CodeBuild's echo of the buildspec,
never the generator's error. It now quotes what the generator printed last.
@nambok
nambok merged commit e4a5507 into main Oct 29, 2026
9 checks passed
@nambok
nambok deleted the finish-planned-work-and-incidents branch October 29, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant